<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <script src="/static/header.js"></script>
</head>

<body>

<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/systemctl/product?list=1&user={{ user }}">NANCAL</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li><a class="btn-group-sm" href="#">{{ user }}</a></li>
                <li><a class="btn-group-sm" href="/login/">退出</a></li>
            </ul>
        </div>
    </div>
</nav>

<div class="container-fluid">
    <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
            <ul class="nav nav-sidebar">
                {% for i in  menu %}

                    {% if list == i.id %}
                        <li class="active"><a href="{{ i.url }}?list={{ i.id }}&user={{ user }}">{{ i.name }}<span class="sr-only">(current)</span></a></li>
                    {% else %}
                        <li><a href="{{ i.url }}?list={{ i.id }}&user={{ user }}">{{ i.name }}<span class="sr-only">(current)</span></a></li>
                    {% endif %}
                {% endfor %}

            </ul>
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <h1 class="page-header">任务管理</h1>

            <!--面板 开始-->
            <div class="panel panel-default">
                <div class="panel-heading"></div>
                <div class="panel-body">
                    <!--表格上面的那一行-->
                    <div class="row">
                        <div class="col-md-11">
                            <form class="form-horizontal" action="/systemctl/task?list=10" method="GET">
                    <div  class="col-sm-4">
                        <input type="text" class="form-control" id="press_name" name="name" placeholder="请输入" value="{{ press_obj }}">
                    </div>
                         <button type="submit" class="btn btn-info bt">查询</button>
                            </form>
                        </div><!-- /.col-lg-6 -->
                        <div class="col-md-1 pull-right">
                            <a class="btn btn-success pull-right" href="/systemctl/add_task/">添加</a>
                        </div>
                    </div>
                    <!--表格上面那一行 结束-->
                    <!--表格 开始-->
                    <div class="table-box">
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th class="text-center">序号</th>
                                <th class="text-center">名称</th>
                                <th class="text-center">机器</th>
                                <th class="text-center">关联1</th>
                                <th class="text-center">关联2</th>
                                <th class="text-center">创建时间</th>
                                <th style="width: 100px;word-break: break-all;text-overflow: ellipsis;overflow: hidden;overflow: hidden" class="text-center">crontab</th>
                                <th class="text-center">备注</th>
                                <th class="text-center">状态</th>
                                <th class="text-center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for i in  ret %}
                            <tr class="text-center">
                                <td>{{ forloop.counter }}</td>
                                <td>{{ i.name }}</td>
                                <td>{{ i.relevance }}</td>
                                <td>{{ i.relevancecmd }}</td>
                                <td>{{ i.relevancecmd1 }}</td>
                                <td>{{ i.timedate }}</td>
                                <td style="width: 100px;word-break: break-all;text-overflow: ellipsis;overflow: hidden;overflow: hidden">每天{{ i.timestart }}点</td>
                                <td>{{ i.remark }}</td>
                                <td  >
                                    {% if "错误" == i.state %}
                                        <p style="color: #0f0f0f;background-color: red">{{ i.state }}</p>
                                    {% endif %}
                                    {% if "错误" != i.state %}
                                        <p style="color: #5bc0de" >{{ i.state }}</p>
                                    {% endif %}
                                </td>
                                <td style="width: 180px;word-break: break-all;text-overflow: ellipsis;overflow: hidden;overflow: hidden">
                                    <a class="btn btn-info btn-sm" href="/systemctl/edit_task/?id={{ i.id }}">编辑</a>
                                    <a class="btn btn-info btn-sm" href="/systemctl/del_task/?id={{ i.id }}">删除</a>
                                </td>
                            </tr>
                             {% endfor %}
                            <P>{{ error_msg  }}</P>
                            </tbody>
                        </table>
                    </div>

                    <!--表格 结束-->
                    <!--分页开始 style="color: #333; 337ab7"-->
                    <div>
                        <nav aria-label="Page navigation" class="pull-right">
                            <ul class="pagination">
                                {% for i in page.page_range %}
                                <li >
                                    {% if i == pageid %}
                                        <a style="background-color: #EEE" href="/systemctl/task/?page_id={{i}}&name={{ press_obj }}">{{i}}</a>
                                    {% endif %}
                                    {% if i != pageid %}
                                        <a   href="/systemctl/task/?page_id={{i}}&name={{ press_obj }}">{{i}}</a>
                                    {% endif %}
                                </li>
                                {% endfor %}
                            </ul>
                        </nav>
                    </div>
                    <!--分页结束-->
                </div>
            </div>
            <!--面板 结束-->
        </div>
    </div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/static/jquery-3.3.1.js"></script>
<script src="/static/bootstrap-3.3.7/js/bootstrap.js"></script>
</body>
</html>